package de.Torgenizer.presentation.Gui.Menu;

import java.awt.event.ActionListener;

import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JSeparator;

public class Menu extends JMenuBar {
	
	//TopMenuPoints
	private JMenu file;
	private JMenu edit;
	private JMenu ward;
	//SubMenuPoints
		//SubFileMenuPoits
			private JMenuItem exit;
			private JMenuItem export;
			private JMenuItem backUp;
		//SubWardMenuPoints
			private JMenuItem editWard;
	private ActionListener actionListner;
	
	public Object getMenuItemByLabel(String s){
		if(s == "exit"){
			return exit;
		}
		else return null;
	}
	
	public void initMenuPoints(){
		file = new JMenu("Datei");
		edit = new JMenu("Bearbeiten");
		ward = new JMenu("Abteilungen");
	}
	
	public void initSubMenus(){
		exit = new JMenuItem("Beenden");
		export = new JMenuItem("Exportieren");
		backUp = new JMenuItem("Sicherheitskopie erstellen");
		
		
		editWard = new JMenuItem("Abteilungen bearbeiten");
		
		file.add(export);
		file.add(backUp);
		file.add(new JSeparator());
		file.add(exit);
		exit.addActionListener(actionListner);
		ward.add(editWard);
	}
	
	public Menu( ActionListener al){
		this.actionListner  = al;
		initMenuPoints();
		initSubMenus();
		this.add(file);
		this.add(edit);
		this.add(ward);
		
	}
	
}
